package com.xuecheng.content.listener;

import com.xuecheng.content.service.CoursePubService;
import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
import org.apache.rocketmq.spring.core.RocketMQListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
@RocketMQMessageListener(consumerGroup = "consumer_coursepub_pub", topic = "${course.publish.topic}")
public class CoursePubConsumerListener implements RocketMQListener<Long> {

    @Autowired
    private CoursePubService coursePubService;

    @Override
    public void onMessage(Long courseBaseId) {
        this.coursePubService.publishPage(courseBaseId);
    }
}
